/*
 * This file is part of FauXML.
 * FauXML is free software: you can redistribute it
 * and/or modify it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of the License,
 * or (at your option) any later version.
 * 
 * FauXML is distributed in the hope that it will be
 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with FauXML.
 * If not, see <http://www.gnu.org/licenses/>.
 */
package com.googlecode.fauxml.util;

/**
 * This class simply holds a pair of data values. It's like a Map that holds
 * just one key with one value. This is used to hold attribute information from
 * XML tags (e.g. for <TAG name="value">, a Pair can hold {name, value})
 * @author Andrew Matta
 */
public final class Pair<K, V> {

	private K key;
	private V value;

	/**
	 * Creates a new empty Pair
	 */
	public Pair() {}

	/**
	 * Creates a new Pair
	 * 
	 * @param key The key, or first datum, of the Pair
	 * @param value The value, or second datum, of the Pair
	 */
	public Pair(K key, V value) {
		this.key = key;
		this.value = value;
	}

	/**
	 * Retrieves the key, or first datum, of this Pair
	 * @return The key
	 */
	public K getKey() {
		return key;
	}

	/**
	 * Retrieves the value, or second datum, of this Pair
	 * @return The value
	 */
	public V getValue() {
		return value;
	}

	/**
	 * Sets the key, or first datum, to the given value
	 * @param The new key for this Pair
	 */
	public void setKey(K key) {
		this.key = key;
	}

	/**
	 * Sets the value, or second datum, to the given value
	 * @param The new second datum for this Pair
	 */
	public void setValue(V value) {
		this.value = value;
	}
}
